﻿using System.Collections.Generic;
using Web7.Ioc;
using System;

namespace Web7.Core.Security
{
    public interface IPermission<Tid> : IDependency
    {
        /// <summary>
        /// 删除一条权限记录
        /// </summary>
        /// <param name="permission">权限记录</param>
        void DeletePermission(Permission permission);

        /// <summary>
        /// 获取一条权限记录
        /// </summary>
        /// <param name="permissionId">权限记录ID</param>
        /// <returns>权限信息</returns>
        Permission GetPermissionById(Tid permissionId);

        /// <summary>
        /// 获取一条权限记录
        /// </summary>
        /// <param name="systemName">权限名称</param>
        /// <returns>权限信息</returns>
        Permission GetPermissionByName(string Name);

        /// <summary>
        /// 获取所有权限信息
        /// </summary>
        /// <returns>所有权限信息</returns>
        IList<Permission> GetAllPermissions();

        /// <summary>
        /// 添加一条权限信息
        /// </summary>
        /// <param name="permission">权限信息</param>
        void InsertPermission(Permission permission);

        /// <summary>
        /// 更新一条权限信息
        /// </summary>
        /// <param name="permission">权限信息</param>
        void UpdatePermission(Permission permission);

        /// <summary>
        /// 安装权限
        /// </summary>
        /// <param name="permissionProvider">IPermissionProvider</param>
        void InstallPermissions(IPermissionProvider permissionProvider);

        /// <summary>
        /// 卸载权限
        /// </summary>
        /// <param name="permissionProvider">IPermissionProvider</param>
        void UninstallPermissions(IPermissionProvider permissionProvider);
    }

    public interface IPermission : IPermission<Guid>
    {
    }
}
